package com.spsy.order.controller.api;

import com.spsy.order.api.SpsyOrderProvider;
import com.spsy.order.domain.Order;
import com.spsy.order.service.IOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: liuzhiping
 * @date: 2024/12/16 16:19
 **/
@RestController
@Slf4j
public class SpsyOrderProviderController implements SpsyOrderProvider {

    @Autowired
    private IOrderService iOrderService;


    /*@RequestMapping("/order/notify2")
    public void notify(@RequestParam(name = "orderId" ,required = false) String orderId ,
                       @RequestParam(name = "payStatus",required = false) Integer payStatus){
        log.info("---->orderId:{} payStatus:{}",orderId,payStatus);

    }*/



    @Override
    public void notify(String orderId, Integer payStatus) {

       log.info("------>99888888 order SpsyOrderProviderController orderId:{} payStatus:{}",orderId,payStatus);

       Order order = Order.builder().ordersStatus(Long.valueOf(payStatus)).build();
       int count = this.iOrderService.insertOrder(order);

       log.info("count:{}",count);

    }
}
